package domain.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * LaboratorioLocal entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "laboratorio_local", catalog = "bms")
public class LaboratorioLocal implements java.io.Serializable {

	// Fields

	private Integer id;
	private String name;
	private Date normalValuesDate;
	private Date normalValuesExpirationDate;
	private String normalValuesLink;
	private Set<LaboratorioLocalExternalValidationType> laboratorioLocalExternalValidationTypes = new HashSet<LaboratorioLocalExternalValidationType>(
			0);
	private Set<ProtocoloCentro> protocoloCentros = new HashSet<ProtocoloCentro>(
			0);
	private Set<Address> addresses = new HashSet<Address>(0);

	// Constructors

	/** default constructor */
	public LaboratorioLocal() {
	}

	/** full constructor */
	public LaboratorioLocal(
			String name,
			Date normalValuesDate,
			Date normalValuesExpirationDate,
			String normalValuesLink,
			Set<LaboratorioLocalExternalValidationType> laboratorioLocalExternalValidationTypes,
			Set<ProtocoloCentro> protocoloCentros, Set<Address> addresses) {
		this.name = name;
		this.normalValuesDate = normalValuesDate;
		this.normalValuesExpirationDate = normalValuesExpirationDate;
		this.normalValuesLink = normalValuesLink;
		this.laboratorioLocalExternalValidationTypes = laboratorioLocalExternalValidationTypes;
		this.protocoloCentros = protocoloCentros;
		this.addresses = addresses;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "normalValuesDate", length = 10)
	public Date getNormalValuesDate() {
		return this.normalValuesDate;
	}

	public void setNormalValuesDate(Date normalValuesDate) {
		this.normalValuesDate = normalValuesDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "normalValuesExpirationDate", length = 10)
	public Date getNormalValuesExpirationDate() {
		return this.normalValuesExpirationDate;
	}

	public void setNormalValuesExpirationDate(Date normalValuesExpirationDate) {
		this.normalValuesExpirationDate = normalValuesExpirationDate;
	}

	@Column(name = "normalValuesLink")
	public String getNormalValuesLink() {
		return this.normalValuesLink;
	}

	public void setNormalValuesLink(String normalValuesLink) {
		this.normalValuesLink = normalValuesLink;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "laboratorioLocal")
	public Set<LaboratorioLocalExternalValidationType> getLaboratorioLocalExternalValidationTypes() {
		return this.laboratorioLocalExternalValidationTypes;
	}

	public void setLaboratorioLocalExternalValidationTypes(
			Set<LaboratorioLocalExternalValidationType> laboratorioLocalExternalValidationTypes) {
		this.laboratorioLocalExternalValidationTypes = laboratorioLocalExternalValidationTypes;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "laboratorioLocals")
	public Set<ProtocoloCentro> getProtocoloCentros() {
		return this.protocoloCentros;
	}

	public void setProtocoloCentros(Set<ProtocoloCentro> protocoloCentros) {
		this.protocoloCentros = protocoloCentros;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "laboratorio_address", catalog = "bms", joinColumns = { @JoinColumn(name = "LABORATORIO_LOCALid", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "Addressid", nullable = false, updatable = false) })
	public Set<Address> getAddresses() {
		return this.addresses;
	}

	public void setAddresses(Set<Address> addresses) {
		this.addresses = addresses;
	}

}